package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * 攻略评论实体类
 */
@Setter
@Getter
public class StrategyComment extends BaseDomain{

    //评论的状态
    public static final int STATE_NOMAL = 0;//草稿
    public static final int STATE_COMMEND = 1;//推荐
    public static final int STATE_DISABEL = -1;//禁用

    //用户
    private User user;
    //创建时间
    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
    private Date createTime;
    //内容
    private String content;
    //评论图片
    private String imgUrls;
    //星星数量
    private Integer starNum;
    //大攻略
    private Strategy strategy;
    //状态
    private Integer state=STATE_NOMAL;
    //推荐时间
    private Date commendTime;
    //标签数组
    private String[] tags;
    //点赞数
    //查询需要参数,评论ID,类型写死
    private Integer countZan;
    //判断某个用户是否点赞
    private int status;


    //拆分并返回图片的数组
    public String[] getImgArr() {
        if (imgUrls!=null && imgUrls.length() != 0) {
            return imgUrls.split(";");
        }
        return null;
    }

}